﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class testmenu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadLoaiSanPham();
    }
    private void LoadLoaiSanPham()
    {
        LoaiSanPhamDataSet lspds;
        //if (loaisanphamid==0)
        //{
        lspds = new LoaiSanPhamHelper().LoadLoaiSanPhamGoc();
        //}
        //else
        //{
        //    lspds = new LoaiSanPhamHelper().LoadLoaiSanPhamConMenu(loaisanphamid);
        //}
        repMenu.DataSource = lspds.LoaiSanPham;
        repMenu.DataBind();
    }

    protected void repMenu_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            LoaiSanPhamHelper lspHP = new LoaiSanPhamHelper();
            Repeater repCon = ((Repeater)e.Item.FindControl("repMenuCon"));
            repCon.DataSource = (lspHP.LoadLoaiSanPhamCon(Convert.ToInt32((((DataRowView)e.Item.DataItem)["LoaiSanPhamID"]))));
            repCon.DataBind();
        }
    }

    protected void repMenuCon_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            LoaiSanPhamHelper lspHP = new LoaiSanPhamHelper();
            Repeater repCon = ((Repeater)e.Item.FindControl("repMenuCon"));
            repCon.DataSource = (lspHP.LoadLoaiSanPhamCon(Convert.ToInt32((((DataRowView)e.Item.DataItem)["LoaiSanPhamID"]))));
            repCon.DataBind();
        }
    }
}
